package net.media.datafw.model;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.media.datafw.DataException;
import net.media.datafw.transport.Transporter;
import net.media.datafw.transport.model.Transportable;

public class ResponseModel implements Transportable {
	private static Logger logger = LoggerFactory.getLogger(ResponseModel.class);
	
	public static final int RESP_CODE_SUCCESS = 0;
	public static final int RESP_CODE_FAILURE = 1;

	public static final String RESP_MSG_SUCCESS = "Operation Success";
	public static final String RESP_MSG_FAILURE_INVALID_OP = "Invalid operation";

	int responseCode;
	String responseMessage;
	Pojo data;
	Pojo[] dataArray;
	
	static {
		try {
			Transporter.registerClass((new ResponseModel()).getClass(), "ResponseModel");
		} catch (DataException se) {
			logger.error("Error in registering Transport Class", se);
		}
	}

	public ResponseModel() {

	}

	public ResponseModel(int responseCode, String responseMessage, Pojo data, Pojo[] dataArray) {
		super();
		this.responseCode = responseCode;
		this.responseMessage = responseMessage;
		this.data = data;
		this.dataArray = dataArray;
	}

	public int getResponseCode() {
		return responseCode;
	}

	public void setResponseCode(int responseCode) {
		this.responseCode = responseCode;
	}

	public String getResponseMessage() {
		return responseMessage;
	}

	public void setResponseMessage(String responseMessage) {
		this.responseMessage = responseMessage;
	}

	public Pojo getData() {
		return data;
	}

	public void setData(Pojo data) {
		this.data = data;
	}

	public Pojo[] getDataArray() {
		return dataArray;
	}

	public void setDataArray(Pojo[] dataArray) {
		this.dataArray = dataArray;
	}

	@Override
	public String toString() {
		return "ResponseModel [responseCode=" + responseCode + ", responseMessage=" + responseMessage + ", data=" + data + "]";
	}
}
